<?php

	define(VICTORY, " VICTORY");
	define(DEFEAT, " DEFEAT");
	define(DRAW, " DRAW");
	
	check_User_Input();

	function check_User_Input(){
		$rock = $_POST['rock'];
		$paper = $_POST['paper'];
		$scissors = $_POST['scissors'];

		if(!$rock){
			echo "USER : ROCK";
			duel(0);
		}elseif(!$paper){
			echo "USER : PAPER";
			duel(1);
		}elseif(!$scissors){
			echo "USER : SCISSORS";
			duel(2);
		}
	}
	
	function duel($input){
		$com = generate();
		
		if($com == $input){
			echo DRAW;
		}
	}
	
	function generate(){
		$generate =  mt_rand(0, 2);
		switch($generate){
			case 0:
				echo " COM : ROCK";
				break;
			case 1:
				echo " COM : PAPER";
				break;
			case 2:
				echo " COM : SCISSORS";
				break;
		}
		return $generate;
	}
	
	function duel_End($input){
		
	}
	
?>